public class evening23112 {
    public static void main(String[] args) {
        System.out.println(sum(123));
    }
    public static int sum(int n){
        if(n < 10){
            return n;
        }
        int tmp = n % 10 + sum(n/10);
        return tmp;
    }
    public static void main2(String[] args) {
        int a = tiyi(12);
        System.out.println(a+"");
    }
    public static void main1(String[] args) {
        fun(10);
    }
    public static void fun(int n) {
        if(n < 10){
            System.out.print(n);
            return;
        }
        fun(n/10);
        System.out.print(n%10);
    }
    public static int tiyi(int n) {
        if(n == 1){
            return 1;
        }
        int tmp = n + tiyi(n-1);
        return tmp;
    }
}
